package com.xuecheng.learning.controller;

import com.xuecheng.commons.model.dto.RecordDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.learning.service.CourseRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 选课记录前端控制器
 * </p>
 *
 * @author itheima
 */
@Slf4j
@RestController
public class CourseRecordController {

    //查询学生的选课状态
    @Autowired
    private CourseRecordService  courseRecordService;

    @PostMapping("/courseRecord/saveRecord")
    public ResponseResult saveRecord(@RequestBody RecordDto dto){
        return courseRecordService.saveRecord(dto);
    }
    // 保存或更新选课记录
    @GetMapping("/courseRecord/myCourseRec/{coursePubId}")
    public ResponseResult getRecord(@PathVariable ("coursePubId") Long coursePubId ){
        return courseRecordService.getRecord(coursePubId);
    }




}
